<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:sijyp="http://java.sun.com/jsf/composite/sijyp"
	xmlns:ui="http://java.sun.com/jsf/facelets">
	<br />
	<h:panelGrid width="100%" id="caracteristicasContainer">

		<script type="javascript">
addTextAreaCounterByClass();</script>
		<h:panelGrid columns="4" width="100%"
			columnClasses="tenenciaFirstColumn, , , ">
			<ui:include src="/general/topBienesFormsFields.xhtml">
				
				<ui:param name="disabledFechaRegistro"
					value="#{not bienCaracteristicaManager.creating or bienManager.reading}" />
				<ui:param name="etapaGestionValue"
					value="#{bienManager.bien.tpEtapaGestion.nombre}" />
				<ui:param name="requiredEtapaGestion" value="false" />
				<ui:param name="disabledEtapaGestion" value="true" />
				<ui:param name="prepId" value="caracteristicas" />
			</ui:include>
		</h:panelGrid>

		<hr />
		<br />
		<h:panelGrid columns="6" width="100%">
			<ui:include src="caracteristicasFields.xhtml">
				<ui:param name="subcaracteristicaObject"
					value="#{bienCaracteristicaManager.subcaracteristica}" />
				<ui:param name="prepId" value="caracteristicas" />
				<ui:param name="renderRequired" value="true" />
				<ui:param name="beanSubcaracteristica"
					value="#{bienCaracteristicaManager}" />
				<ui:param name="fileUploadContainerId"
					value="fileUploadContainerCaracteristicas" />
				<ui:param name="disableAllFields"
					value="#{bienCaracteristicaManager.reading or bienManager.reading}" />
			</ui:include>
		</h:panelGrid>
		<h:panelGrid id="fileUploadContainerCaracteristicas" width="100%">
			<ui:fragment rendered="#{bienCaracteristicaManager.renderArchivo}">
				<hr />
			</ui:fragment>
			<sijyp:fileUploadSijyp
				tiposDocumentos="#{applicationBean.tipoDocumentoBienDocumentos}"
				rendered="#{bienCaracteristicaManager.renderArchivo}"
				isReading="#{bienCaracteristicaManager.reading}"
				bean="#{bienCaracteristicaManager.fileUploadBean}" 
				required="true"
				labelUpload="${msg['bienes.caracteristicasFields.documento']}"
				/>
				
		</h:panelGrid>

		<h:panelGroup style="text-align:center;" layout="block">
			<h:commandButton
				rendered="#{not bienCaracteristicaManager.reading and not bienManager.reading}"
				action="#{bienCaracteristicaManager.guardarSubcaracteristicaValor}"
				value="#{bienCaracteristicaManager.creating ? msg['boton.adicionar'] : (bienCaracteristicaManager.updating ? msg['boton.modificar'] : '')}">
				<f:ajax execute="caracteristicasContainer"
					render=":sijypMessages :formTabs:caracteristicasContainer" />
			</h:commandButton>
			<h:commandButton value="${msg['boton.cancelar']}"
				rendered="#{not bienManager.reading}"
				action="#{bienCaracteristicaManager.init}">
				<f:ajax render=":formTabs:caracteristicasContainer" execute="@this" />
			</h:commandButton>
		</h:panelGroup>
		<br />

		<ui:include src="caracteristicasTable.xhtml" />
		<sijyp:confirmDialog message="${msg['general.confirmaBorrar']}"
			confirmId="confirmDeleteCaracteristica"
			renderComponents="confirmDeleteCaracteristica :sijypMessages :formTabs:caracteristicasContainer"
			acceptAction="#{bienCaracteristicaManager.deleteCaracteristica}" />

	</h:panelGrid>
</ui:composition>
